package com.rykj.qxj.server.services.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rykj.qxj.server.dao.SystemLogMapper;
import com.rykj.qxj.server.model.entity.ApiVersionManage;
import com.rykj.qxj.server.model.entity.SystemLog;
import com.rykj.qxj.server.services.ISystemLogService;

@Service
public class SystemLogServiceImpl implements ISystemLogService {
	
	@Autowired
	private SystemLogMapper systemLogMapper;

	@Override
	public void saveSystemLog(SystemLog systemLog) {
		systemLogMapper.saveSystemLog(systemLog);

	}

	@Override
	public PageInfo selectSystemLogBySearchParams(Integer pageNum, Integer pageSize, String userName, String ip,String startTime,String endTime) {
		PageHelper.startPage(pageNum,pageSize);
        Map<String,Object> paraMap =new HashMap<>();
        paraMap.put("userName",userName);
        paraMap.put("ip",ip);
        paraMap.put("startTime",startTime);
        paraMap.put("endTime",endTime);
       List<SystemLog> selectSystemLogBySearchParams = systemLogMapper.selectSystemLogBySearchParams(paraMap);
		PageInfo page=new PageInfo<>(selectSystemLogBySearchParams);
		return page;
	}

}
